/**
 * @file 12.c
 * @author your name (you@domain.com)
 * @brief 菲波那切数列
 * @version 0.1
 * @date 2022-04-13
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#include <stdio.h>

int main()
{
    int i, n, t1 = 0, t2 = 1, nextTerm = 0;
    printf("Enter the number of terms: ");
    scanf("%d", &n);
    // displays the first two terms which is always 0 and 1
    printf("Fibonacci Series: %d, %d", t1, t2);
    // i = 3 because the first two terms are already displayed
    for (i = 3; i <= n; ++i)
    {
        nextTerm = t1 + t2;
        t1 = t2;
        t2 = nextTerm;
        printf("%d, ", nextTerm);
    }
    return 0;
}